For centuries, navigators and others have indirectly used the Earth's magnetic field to determine direction. This is possible because the magnetic field has a component parallel to the Earth's surface that always points toward magnetic north, and this north-indicating component can be detected with a compass. The magnetic field can be approximated with a dipole model where the field points down toward north in the northern hemisphere, is horizontal and pointing north at the equator, and points up toward north in the southern hemisphere.
The magnitude of the Earth's magnetic field remains somewhat constant over fairly large areas, and ranges from about 0.4 to 0.6 gauss over most of the northern hemisphere. Solid-state electronic devices are now sensitive enough to easily measure the Earth's magnetic field. The accuracy of electronic compasses is somewhat dependent on the tilt of the compass itself: if a compass is held perfectly flat (that is, parallel with the local horizontal plane, which is simply the plane that is perpendicular to the Earth's gravitational vector), the compass heading is defined as:Heading=arcTan(Y/X)  (1) where X and Y represent the Earth's horizontal magnetic field components in the forward and left-right directions, respectively. Heading is the angle in the horizontal plane measured clockwise from true north.
However, compasses are not usually confined to perfectly horizontal orientations, but are instead subjected to some tilt, either because they are handheld or solidly mounted in a tilted vehicle. Using aviation convention, tilt is defined as either pitch or roll relative to the local horizontal plane; pitch is the angle between an aircraft's longitudinal axis and the local horizontal plane (positive for nose-up pitch) and roll is the angle of rotation about the longitudinal axis (positive for right wing down).
If no correction is made for tilt, heading errors will occur; for a pitch of +/−10°, for example, maximum heading errors of approximately 9° will occur at headings of about 90° and 270°, with smaller errors at other headings.
Electronic compasses, which are capable of digitally processing signals produced by electrical magnetic sensors, can be compensated numerically for tilt and other factors. For a tilted compass to make an accurate heading measurement, tilt must be taken into account, because equation (1) is no longer accurate. Typically, 3-axis electronic magnetic sensors have been used in conjunction with 2-axis tilt sensors to overcome inaccuracies that occur due to tilt. Three-axis magnetic sensors measure the Earth's magnetic field in mutually orthogonal directions.
If both the pitch (φ) and roll (θ) angles are measured by a tilt sensor, the following rotation equations can be used to mathematically rotate the tilted compass back to the horizontal plane, where a heading can again be calculated using equation (1):X=X cos φ+Y sin2 φ−Z cos φ sin φ  (2) Y=Y cos θ+Z sin θ  (3) where z represents the Earth's magnetic field component that is orthogonal to a magnetic sensor's x and y axes and X and Y represent X and Y axis readings transformed to the local horizontal plane. Equations 2 and 3 can be solved numerically using inputs from a 3-axis magnetic sensor and at least a 2-axis tilt sensor.
In some compass applications, however, such as cell phones and watches, not enough space is available for a 3-axis magnetic sensor, which requires two sensors in one plane and a third sensor in another orthogonal plane. Thus, a solution that would allow more accurate heading measurements without the use (and increased size) of a 3-axis magnetic sensor is desired.